import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    show:false,
    regshow:false,
    regname:'',
    //用户数据存储
    userid:'',     //用户id
    username:'',   //用户名
    usertel:'',    //用户手机号
    userpwd:'',    //用户密码
    isLogin:false,  //登录状态
    token:''   //存储用户的token
  },
  mutations: {
    //修改token
    settoken(state,token){
      state.token = token;
    },
    //用户信息存储
    setuserid(state,uid){
      state.userid = uid;
    },
    setusertel(state,utel){
      state.usertel = utel;
    },
    setusername(state,uname){
      state.username = uname;
    },
    setuserpwd(state,upwd){
      state.userpwd = upwd;
    },
    setislogin(state,p){
      state.isLogin = p;
    },
    setshow(state,show){
      state.show=show
    },
    setregshow(state,regshow){
      state.regshow=regshow
    },
    setregname(state,regnames){
      state.regname=regnames
    }
  },
  actions: {
  },
  modules: {
  }
})
